#ifndef _FDB_PAGE_ENCRYPT_H_
#define _FDB_PAGE_ENCRYPT_H_

#ifdef FDD
#include "c.h"
#include "port/fdb_crypt.h"

extern int g_tde_encrypt;

int fdb_initPageEncrypt(const unsigned char *Extkey, uint64 mixkey,unsigned char * tde_encrypt_tablekey, FDB_ENCRYPT_TYPE type, bool is_new_gen_key);
int fdb_updatePageEncrypt(const unsigned char *old_Extkey, const unsigned char *new_Extkey, uint64 mixkey,unsigned char * tde_encrypt_tablekey, FDB_ENCRYPT_TYPE type);
void fdb_destroyPageEncrypt(void);
void fdb_getPageEncryptKey(char *program, unsigned char *Extkey);
uint64 fdb_checkPageEncryptSecKey(const unsigned char *fkey, uint64 mixkey, const unsigned char * tde_encrypt_tablekey, uint64 chkkey);
uint64 fdb_getPageEncryptChkKey(const unsigned char *fkey, uint64 mixkey, const unsigned char * tde_encrypt_tablekey);

//pageData数据长度必须是BLCKSZ
void * fdb_encodePage(void *pageData, uint32 blocknum);
void fdb_decodePage(void *pageData, uint32 blocknum);

#endif //FDD

#endif //_FDB_PAGE_ENCRYPT_H_
